package com.atguigu.yygh.hosp.controller.admin;

import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import com.atguigu.yygh.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/*==========================================
      时 间:   2022-04-20
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;


    @GetMapping("/detail/{hoscode}/{depcode}/{workdate}")
    public R getScheduleDetail(@PathVariable String hoscode,
                               @PathVariable String depcode,
                               @PathVariable String workdate){
       List<Schedule> schedules= scheduleService.getScheduleDetail(hoscode,depcode,workdate);

       return R.ok().data("list",schedules);
    }

    @GetMapping("/{hoscode}/{depcode}/{page}/{limit}")
    public R getSchedulePage(@PathVariable String hoscode,
                             @PathVariable String depcode,
                             @PathVariable Integer page,
                             @PathVariable Integer limit){

        Map<String,Object> map=scheduleService.getSchedulePage(hoscode,depcode,page,limit);
        return R.ok().data(map);
    }

}
